﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 学生绩效
{
    delegate void ShowWrongMessage();
    public partial class Form1 : Form
    {
        private string _choicename;

        private bool mouseDownFlag = false;
        System.Drawing.Point frmLocation = new System.Drawing.Point(0, 0);
        ShowWrongMessage deleShowWrongMsg;

        public string Choicename { get => _choicename; set => _choicename = value; }

        public Form1()
        {
            InitializeComponent();
            this.FormBorderStyle = FormBorderStyle.None;
            this.StartPosition = FormStartPosition.CenterScreen;
        }
       
        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            frmLocation = e.Location;
            mouseDownFlag = true;
        }

        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            if (mouseDownFlag)
            {
                this.Left += (e.X - frmLocation.X);
                this.Top += (e.Y - frmLocation.Y);
            }
        }

        private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            mouseDownFlag = false;
            this.Left += (e.X - frmLocation.X);
            this.Top += (e.Y - frmLocation.Y);
        }
        private void ShowWrongMsg()
        {
            Graphics g = this.CreateGraphics();
            Brush bru = new System.Drawing.SolidBrush(Color.Red);
            g.DrawString(string.Format("Author:Jack Zhang{0}TEL:185-7827-6660",Environment.NewLine)
                , new Font("黑体", 14), bru, new PointF(0, 0));
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            var imgPathofXueye = System.IO.Path.GetFullPath(@"pictures/xueye1.png");
            var imgPathofZhiye = System.IO.Path.GetFullPath(@"pictures/zhiye.png");
            var greenenergy = System.IO.Path.GetFullPath(@"pictures/green.png");
            this.label1.Image = Image.FromFile(imgPathofXueye);
            this.label2.Image = Image.FromFile(imgPathofZhiye);
            this.label3.Image = Image.FromFile(greenenergy);
            deleShowWrongMsg = new ShowWrongMessage(ShowWrongMsg);
        }
        private void label3_Click(object sender, EventArgs e)
        {
            this.Invoke(deleShowWrongMsg);
        }

        private void label1_Click(object sender, EventArgs e)
        {
            this.Choicename = "xueye";
            FormXueye fxfrm = new FormXueye(this);
            fxfrm.Show();
        }

        private void label2_Click(object sender, EventArgs e)
        {
            this.Choicename = "zhiye";
            FormXueye fxfrm = new FormXueye(this);
            fxfrm.Show();
        }
    }
}
